﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utils.Extention;
using System.Text.RegularExpressions;
#region Version Info
/* ========================================================================
* 【本页面功能概述】
*
* 作者：wangjianfeng 创建时间：2012/9/22 11:38:29
* 文件名：ExpertTeam.cs
*
* 修改者： 时间：
* 修改说明：
* ========================================================================
*/
#endregion
namespace ChinaLeg.Web
{
    public partial class ExpertTeam : System.Web.UI.Page
    {
        protected string title, description, keyWrods,bgImage,adScroll;
        
        protected int catid;

        protected string vTitle, vSrc;

        protected string href50, desc50;

        protected void Page_Load(object sender, EventArgs e)
        {
            catid = 13;
            if (!this.IsPostBack)
            {
                ChinaLeg.Cache.Category.Instance.GetModel(catid, out title, out  keyWrods, out  description, out  bgImage);
                Top1.CatId = catid;
                Top1.BgImage = bgImage;
                adScroll = ChinaLeg.Cache.ScrollFocusPicture.Instance.GetList(catid);

                List<ChinaLeg.Model.News> newslist = ChinaLeg.BLL.News.Instance.GetList(" and ListCommend=1 and catid=50", 5, "ShowOrder", 0);
                rtpList.DataSource = newslist;
                rtpList.DataBind();
                if (newslist.Count > 0)
                {
                    href50 = ChinaLeg.Web.Lib.WebLinks.GetNewsLinks(newslist[0].Id);
                    desc50 =  newslist[0].Description.SubStringByBytes(216 , false);
                }

                rptCommend.DataSource = ChinaLeg.BLL.News.Instance.GetList(" and DetailsCommend=1 and catid=50", 15, "ShowOrder", 0);
                rptCommend.DataBind();
                rptRelation.DataSource = ChinaLeg.BLL.News.Instance.GetList(" and catid=50", 15, "MidifyTime", 1);
                rptRelation.DataBind();

                


                List<ChinaLeg.Model.CaseShow> list = ChinaLeg.BLL.CaseShow.Instance.GetList(49);
                rptVideo.DataSource = list;
                rptVideo.DataBind();
                if (list.Count > 0)
                {
                    vSrc = GetVideoSrc(list[0].Content);
                    vTitle = list[0].Name;
                }

            }

        }

        protected string GetVideoSrc(object obj)
        {
            Regex reg = new Regex(".+src=\"([^\"]+)\".+", RegexOptions.IgnoreCase);
            //return reg.Replace(obj.ToTrim(), "$1");

            Match mc = reg.Match(obj.ToTrim());

            if (mc.Groups.Count > 1)
            {
                return mc.Groups[1].Value;
            }
            else
            {
                return "";
            }
        }
    }
}